<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in">
      <div class="cornerComment-in-title">
        <span>因病缺勤报备</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <el-form :model="infoForm" label-width="160px" ref="editForm">
          <el-form-item label="体温:">
            <el-input v-model="infoForm.temperature" placeholder="请输入内容">
              <template slot="append">℃</template>
            </el-input>
          </el-form-item>
          <el-form-item label="主要症状（是否新发）:">
            <el-input
                type="textarea"
                placeholder="请输入体温"
                v-model="infoForm.symptom"
                maxlength="200"
                show-word-limit
            >
            </el-input>
          </el-form-item>
          <el-form-item label="处理情况:">
            <el-input
                type="textarea"
                placeholder="请输入处理情况"
                v-model="infoForm.handle"
                maxlength="200"
                show-word-limit
            >
            </el-input>
          </el-form-item>
          <el-form-item label="反馈信息（就诊时间、单位）:">
            <el-input
                type="textarea"
                placeholder="请输入反馈信息"
                v-model="infoForm.feedback"
                maxlength="200"
                show-word-limit
            >
            </el-input>
          </el-form-item>
        </el-form>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click.native="closePOpup" size="small">取消</el-button>
        <el-button size="small" type="primary" @click="checkEditFn">确定修改</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {leaveStudentSick} from '@/api/admin/student_leave'

export default {
  props: ['visible', 'sickOption'],
  components: {},
  data() {
    return {
      dialogVisible: false,
      infoForm: {
        leave_id: '', // 请假id
        temperature: '', // 体温
        symptom: '', // 主要症状
        handle: '', // 处理
        feedback: '', // 反馈
      },
    }
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible
      if (this.visible) {
        this.infoForm.leave_id = this.sickOption.id
        this.infoForm.temperature = this.sickOption.handle ? this.sickOption.handle.temperature : ''
        this.infoForm.symptom = this.sickOption.handle ? this.sickOption.handle.symptom : ''
        this.infoForm.handle = this.sickOption.handle ? this.sickOption.handle.handle : ''
        this.infoForm.feedback = this.sickOption.handle ? this.sickOption.handle.feedback : ''
      } else {
        this.infoForm = {
          leave_id: '', // 请假id
          temperature: '', // 体温
          symptom: '', // 主要症状
          handle: '', // 处理
          feedback: '', // 反馈
        }
      }
    }
  },
  created() {

  },
  methods: {
    checkEditFn() {
      leaveStudentSick(this.infoForm).then(res => {
        if (!res.code) {
          this.$emit('InitFn')
          this.closePOpup()
        }
      })

    },
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    }
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 550px;
  height: 450px;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

.resruitment-title {
  padding: 5px 0;
  border-bottom: 2px solid #abd3f3;
  margin-bottom: 20px;
}

.el-radio {
  margin-right: 20px;
}

.jobTime {
  display: flex;
  align-items: center;
}

.jobTime span {
  padding: 0 10px;
}
</style>


